home *** CD-ROM | disk | FTP | other *** search
- #include <exec/types.h>
- #include <exec/memory.h>
- #include <intuition/intuition.h>
- #include <intuition/gadgetclass.h>
- #include <libraries/gadtools.h>
- #include <dos/dosextens.h>
- #include <graphics/gfx.h>
-
- #include <clib/exec_protos.h>
- #include <clib/intuition_protos.h>
- #include <clib/gadtools_protos.h>
- #include <clib/dos_protos.h>
- #include <clib/graphics_protos.h>
-
- #define ALL_REACTION_CLASSES
- #define ALL_REACTION_MACROS
- #include <reaction/reaction.h>
-
- #include <ctype.h>
- #include <stdlib.h>
- #include <string.h>
- #include "rp.h"
-
- #define AMIGA 0
- #define MAC 1
- #define IBM 2
-
- // from rp.c
- IMPORT TEXT IOBuffer[LONGESTFIELD + 1];
- IMPORT ABOOL fillwindows, stop;
- IMPORT SBYTE page;
- IMPORT SWORD y;
- IMPORT TEXT asldir[PATHNAMEFIELD + 1];
- IMPORT ULONG fillcolour;
- IMPORT struct NewGadget Gadget;
- IMPORT struct Window* MainWindowPtr;
- IMPORT struct Screen* ScreenPtr;
- IMPORT struct IconBase* IconBase;
- IMPORT struct SharedStruct shared;
- IMPORT Object* WinObject[FUNCTIONS + 1];
- IMPORT struct Menu* MenuPtr;
-
- MODULE struct
- { ULONG detabulate, unwrap, source, dest, tabsize;
- TEXT pathname[PATHNAMEFIELD + 1];
- } eol =
- { FALSE, FALSE, IBM, AMIGA, 8, ""
- };
-
- AGLOBAL struct Gadget* eol_gadgets[GIDS_7 + 1];
-
- MODULE STRPTR EOLOptions[4] =
- { (STRPTR) "LF (Amiga)",
- (STRPTR) "CR (Macintosh)",
- (STRPTR) "CR+LF (IBM-PC)",
- NULL
- };
-
- MODULE ABOOL spaceeol(TEXT nextchar);
-
- AGLOBAL void eol1(void)
- { struct Hook Hook7Struct;
-
- InitHook(&Hook7Struct, Hook7Func, NULL);
-
- /* Create the window object. */
- lockscreen();
- if (!(WinObject[7] = NewObject(WINDOW_GetClass(), NULL,
- // window
- WA_PubScreen, ScreenPtr,
- WA_ScreenTitle, "Report+",
- WA_Title, "Report+: EOL/Tab Converter",
- WA_Activate, TRUE,
- WA_DepthGadget, TRUE,
- WA_DragBar, TRUE,
- WA_CloseGadget, TRUE,
- WA_SizeGadget, TRUE,
- WA_IDCMP, IDCMP_RAWKEY,
- WINDOW_IDCMPHook, &Hook7Struct,
- WINDOW_IDCMPHookBits, IDCMP_RAWKEY,
- WINDOW_MenuStrip, MenuPtr,
- WINDOW_Position, WPOS_CENTERSCREEN,
- WINDOW_ParentGroup, eol_gadgets[GID_7_LY1] =
- NewObject(LAYOUT_GetClass(), NULL,
- // root-layout
- LAYOUT_Orientation, LAYOUT_ORIENT_VERT,
- LAYOUT_SpaceOuter, TRUE,
- LAYOUT_DeferLayout, TRUE,
- LAYOUT_AddChild,
- NewObject
- ( LAYOUT_GetClass(), NULL,
- LAYOUT_Orientation, LAYOUT_ORIENT_HORIZ,
- LAYOUT_VertAlignment, LALIGN_CENTER,
- LAYOUT_HorizAlignment,LALIGN_CENTER,
- LAYOUT_BevelStyle, BVS_NONE,
- LAYOUT_AddChild,
- NewObject
- ( LAYOUT_GetClass(), NULL,
- LAYOUT_Orientation, LAYOUT_ORIENT_VERT,
- LAYOUT_SpaceOuter, TRUE,
- LAYOUT_VertAlignment, LALIGN_CENTER,
- LAYOUT_HorizAlignment,LALIGN_CENTER,
- LAYOUT_BevelStyle, BVS_FIELD,
- LAYOUT_AddImage, NewObject
- ( LABEL_GetClass(), NULL,
- LABEL_Text, "_Source:",
- LABEL_Justification, LJ_CENTER,
- TAG_END),
- CHILD_WeightedHeight, 0,
- LAYOUT_AddChild, eol_gadgets[GID_7_RA1] =
- NewObject
- ( RADIOBUTTON_GetClass(),NULL,
- GA_ID, GID_7_RA1,
- GA_RelVerify, TRUE,
- GA_Text, EOLOptions,
- RADIOBUTTON_Selected, (WORD) eol.source,
- TAG_END),
- TAG_END),
- CHILD_WeightedWidth, 50,
- LAYOUT_AddChild,
- NewObject
- ( LAYOUT_GetClass(), NULL,
- LAYOUT_Orientation, LAYOUT_ORIENT_VERT,
- LAYOUT_SpaceOuter, TRUE,
- LAYOUT_VertAlignment, LALIGN_CENTER,
- LAYOUT_HorizAlignment,LALIGN_CENTER,
- LAYOUT_BevelStyle, BVS_FIELD,
- LAYOUT_AddImage, NewObject
- ( LABEL_GetClass(), NULL,
- LABEL_Text, "_Destination:",
- LABEL_Justification, LJ_CENTER,
- TAG_END),
- CHILD_WeightedHeight, 0,
- LAYOUT_AddChild, eol_gadgets[GID_7_RA2] =
- NewObject
- ( RADIOBUTTON_GetClass(),NULL,
- GA_ID, GID_7_RA2,
- GA_RelVerify, TRUE,
- GA_Text, EOLOptions,
- RADIOBUTTON_Selected, (WORD) eol.dest,
- TAG_END),
- TAG_END),
- CHILD_WeightedWidth, 50,
- TAG_END),
- LAYOUT_AddChild,
- NewObject
- ( LAYOUT_GetClass(), NULL,
- LAYOUT_Orientation, LAYOUT_ORIENT_HORIZ,
- LAYOUT_VertAlignment, LALIGN_CENTER,
- LAYOUT_HorizAlignment,LALIGN_CENTER,
- LAYOUT_BevelStyle, BVS_NONE,
- LAYOUT_AddChild, eol_gadgets[GID_7_CB1] =
- NewObject
- ( CHECKBOX_GetClass(), NULL,
- GA_ID, GID_7_CB2,
- GA_RelVerify, TRUE,
- GA_Text, "C_onvert tabs to spaces?",
- GA_Selected, (BOOL) eol.detabulate,
- TAG_END),
- CHILD_WeightedWidth, 0,
- LAYOUT_AddImage,
- NewObject
- ( LABEL_GetClass(), NULL,
- LABEL_Text, "",
- TAG_END),
- CHILD_WeightedWidth, 100,
- LAYOUT_AddImage,
- NewObject
- ( LABEL_GetClass(), NULL,
- LABEL_Text, "_Tab size:",
- TAG_END),
- CHILD_WeightedWidth, 0,
- LAYOUT_AddChild, eol_gadgets[GID_7_IN1] =
- NewObject
- ( INTEGER_GetClass(), NULL,
- GA_ID, GID_7_IN1,
- GA_RelVerify, TRUE,
- GA_TabCycle, TRUE,
- INTEGER_Number, eol.tabsize,
- INTEGER_Minimum, 0,
- INTEGER_Maximum, 99,
- INTEGER_MinVisible, 2,
- TAG_END),
- CHILD_WeightedWidth, 0,
- TAG_END),
- CHILD_WeightedHeight, 0,
- LAYOUT_AddChild, eol_gadgets[GID_7_CB2] =
- NewObject
- ( CHECKBOX_GetClass(), NULL,
- GA_ID, GID_7_CB2,
- GA_RelVerify, TRUE,
- GA_Text, "_Unwrap words?",
- GA_Selected, (BOOL) eol.unwrap,
- TAG_END),
- CHILD_WeightedHeight, 0,
- LAYOUT_AddChild,
- NewObject
- ( LAYOUT_GetClass(), NULL,
- LAYOUT_Orientation, LAYOUT_ORIENT_HORIZ,
- LAYOUT_VertAlignment, LALIGN_CENTER,
- LAYOUT_HorizAlignment, LALIGN_CENTER,
- LAYOUT_BevelStyle, BVS_NONE,
- LAYOUT_AddImage,
- NewObject
- ( LABEL_GetClass(), NULL,
- LABEL_Text, "_Pathname(s):",
- LABEL_Justification, LJ_LEFT,
- TAG_END),
- LAYOUT_AddChild, eol_gadgets[GID_7_ST1] =
- NewObject
- ( STRING_GetClass(), NULL,
- GA_ID, GID_7_ST1,
- GA_RelVerify, TRUE,
- STRINGA_TextVal, eol.pathname,
- STRINGA_MinVisible, 20,
- TAG_END),
- LAYOUT_AddChild, eol_gadgets[GID_7_BU1] =
- NewObject
- ( NULL, "button.gadget",
- GA_ID, GID_7_BU1,
- GA_RelVerify, TRUE,
- BUTTON_AutoButton,BAG_POPFILE,
- TAG_END),
- CHILD_WeightedWidth, 0,
- TAG_END),
- CHILD_WeightedHeight, 0,
- LAYOUT_AddChild, eol_gadgets[GID_7_ST2] =
- NewObject
- ( STRING_GetClass(), NULL,
- GA_ReadOnly, TRUE,
- GA_ID, GID_7_ST2,
- STRINGA_TextVal, "Ready.",
- TAG_END),
- CHILD_WeightedHeight, 0,
- LAYOUT_AddChild,
- NewObject
- ( LAYOUT_GetClass(), NULL,
- LAYOUT_Orientation, LAYOUT_ORIENT_HORIZ,
- LAYOUT_VertAlignment, LALIGN_CENTER,
- LAYOUT_HorizAlignment,LALIGN_CENTER,
- LAYOUT_BevelStyle, BVS_NONE,
- LAYOUT_AddChild, eol_gadgets[GID_7_BU3] =
- NewObject(NULL, "button.gadget",
- GA_ID, GID_7_BU3,
- GA_RelVerify, TRUE,
- GA_Text, "Pro_cess",
- TAG_END),
- CHILD_WeightedWidth, 50,
- LAYOUT_AddChild, eol_gadgets[GID_7_BU4] =
- NewObject(NULL, "button.gadget",
- GA_ID, GID_7_BU4,
- GA_RelVerify, TRUE,
- GA_Text, "Stop",
- GA_Disabled, TRUE,
- TAG_END),
- CHILD_WeightedWidth, 50,
- TAG_END),
- CHILD_WeightedHeight, 0,
- TAG_END)
- )))
- { rq("Can't create ReAction objects!");
- }
- unlockscreen();
- openwindow();
- ActivateLayoutGadget(eol_gadgets[GID_7_LY1], MainWindowPtr, NULL, (Object) eol_gadgets[GID_7_ST1]);
-
- loop();
- closewindow();
- }
-
- AGLOBAL void eol_do(void)
- { STRPTR stringptr;
- ABOOL anyfound;
-
- if (!(GetAttr
- ( STRINGA_TextVal, eol_gadgets[GID_7_ST1], (ULONG *) &stringptr
- )))
- { rq("Unsupported inquiry!"); // should never happen
- }
- strcpy(eol.pathname, stringptr);
- if (!(GetAttr
- ( INTEGER_Number, eol_gadgets[GID_7_IN1], (ULONG *) &eol.tabsize
- )))
- { rq("Unsupported inquiry!"); // should never happen
- }
-
- SetGadgetAttrs
- ( eol_gadgets[GID_7_BU4], MainWindowPtr, NULL,
- GA_Disabled, FALSE,
- TAG_END);
- SetGadgetAttrs
- ( eol_gadgets[GID_7_RA1], MainWindowPtr, NULL,
- GA_Disabled, TRUE,
- TAG_END);
- SetGadgetAttrs
- ( eol_gadgets[GID_7_RA2], MainWindowPtr, NULL,
- GA_Disabled, TRUE,
- TAG_END);
- SetGadgetAttrs
- ( eol_gadgets[GID_7_ST1], MainWindowPtr, NULL,
- GA_Disabled, TRUE,
- TAG_END);
- SetGadgetAttrs
- ( eol_gadgets[GID_7_BU1], MainWindowPtr, NULL,
- GA_Disabled, TRUE,
- TAG_END);
- SetGadgetAttrs
- ( eol_gadgets[GID_7_CB1], MainWindowPtr, NULL,
- GA_Disabled, TRUE,
- TAG_END);
- SetGadgetAttrs
- ( eol_gadgets[GID_7_CB2], MainWindowPtr, NULL,
- GA_Disabled, TRUE,
- TAG_END);
- SetGadgetAttrs
- ( eol_gadgets[GID_7_IN1], MainWindowPtr, NULL,
- GA_Disabled, TRUE,
- TAG_END);
- SetGadgetAttrs
- ( eol_gadgets[GID_7_BU3], MainWindowPtr, NULL,
- GA_Disabled, TRUE,
- TAG_END);
-
- strcpy(shared.pathname, eol.pathname);
- anyfound = convert(TRUE);
- strcpy(eol.pathname, shared.pathname);
-
- if (!stop)
- { if (anyfound)
- { SetGadgetAttrs
- ( eol_gadgets[GID_7_ST2], MainWindowPtr, NULL,
- STRINGA_TextVal, "All done.",
- TAG_END);
- } else
- { SetGadgetAttrs
- ( eol_gadgets[GID_7_ST2], MainWindowPtr, NULL,
- STRINGA_TextVal, "No matches!",
- TAG_END);
- } }
- SetGadgetAttrs
- ( eol_gadgets[GID_7_BU4], MainWindowPtr, NULL,
- GA_Disabled, TRUE,
- TAG_END);
- SetGadgetAttrs
- ( eol_gadgets[GID_7_RA1], MainWindowPtr, NULL,
- GA_Disabled, FALSE,
- TAG_END);
- SetGadgetAttrs
- ( eol_gadgets[GID_7_RA2], MainWindowPtr, NULL,
- GA_Disabled, FALSE,
- TAG_END);
- SetGadgetAttrs
- ( eol_gadgets[GID_7_ST1], MainWindowPtr, NULL,
- GA_Disabled, FALSE,
- TAG_END);
- SetGadgetAttrs
- ( eol_gadgets[GID_7_BU1], MainWindowPtr, NULL,
- GA_Disabled, FALSE,
- TAG_END);
- SetGadgetAttrs
- ( eol_gadgets[GID_7_CB1], MainWindowPtr, NULL,
- GA_Disabled, FALSE,
- TAG_END);
- SetGadgetAttrs
- ( eol_gadgets[GID_7_CB2], MainWindowPtr, NULL,
- GA_Disabled, FALSE,
- TAG_END);
- SetGadgetAttrs
- ( eol_gadgets[GID_7_IN1], MainWindowPtr, NULL,
- GA_Disabled, FALSE,
- TAG_END);
- SetGadgetAttrs
- ( eol_gadgets[GID_7_BU3], MainWindowPtr, NULL,
- GA_Disabled, FALSE,
- TAG_END);
- }
-
- AGLOBAL void eolconvert(ABOOL gui)
- { ULONG gap, i, j, cursorx = 0;
- ABOOL ok = TRUE;
- struct FileInfoBlock InputInfoBlock;
- UBYTE* InputBufferPtr; // always use UBYTE not APTR for pointer arithmetic
- BPTR FileHandle;
- TEXT saystring[PATHNAMEFIELD + 1];
-
- strcpy(saystring, "Converting ");
- strcat(saystring, shared.thisfile);
- strcat(saystring, "...");
- if (gui)
- { SetGadgetAttrs
- ( eol_gadgets[GID_7_ST2], MainWindowPtr, NULL,
- STRINGA_TextVal, saystring,
- TAG_END);
- } else
- { Printf("%s", saystring);
- Flush(Output());
- }
-
- if (FileHandle = (BPTR) Lock(shared.thisfile, ACCESS_READ))
- { if (Examine(FileHandle, &InputInfoBlock))
- { UnLock(FileHandle);
- // FileHandle = NULL;
- if (InputInfoBlock.fib_DirEntryType == -3) // if a file
- { // if it is a directory, we would ideally like to convert all
- // files in that directory. We also should support links.
- if (InputBufferPtr = AllocMem(InputInfoBlock.fib_Size, MEMF_ANY | MEMF_PUBLIC))
- { if (FileHandle = (BPTR) Open(shared.thisfile, MODE_OLDFILE))
- { if (Read(FileHandle, InputBufferPtr, InputInfoBlock.fib_Size) != -1)
- { Close(FileHandle);
- if (FileHandle = (BPTR) Open(shared.thisfile, MODE_NEWFILE))
- { for (i = 0; i < InputInfoBlock.fib_Size; i++)
- { if (*(InputBufferPtr + i) == LF)
- { if (eol.unwrap && (eol.source == AMIGA || eol.source == IBM) && spaceeol(*(InputBufferPtr + i + 1)))
- { cursorx++;
- FPutC(FileHandle, ' ');
- } else
- { cursorx = 0;
-
- if (eol.source == eol.dest)
- FPutC(FileHandle, LF); // pass it through
- elif (eol.source == AMIGA && eol.dest == IBM)
- { FPutC(FileHandle, CR); // add this
- FPutC(FileHandle, LF); // and pass this through
- } elif (eol.source == AMIGA && eol.dest == MAC)
- FPutC(FileHandle, CR); // convert from LF to CR
- elif (eol.source == IBM && eol.dest == AMIGA)
- FPutC(FileHandle, LF); // pass it through
- elif (eol.source == IBM && eol.dest == MAC)
- ; // do nothing
- else ; // mac as source: we never expect LFs
- } }
- elif (*(InputBufferPtr + i) == CR)
- { if (eol.unwrap && eol.source == MAC && spaceeol(*(InputBufferPtr + i + 1)))
- { cursorx++;
- FPutC(FileHandle, ' ');
- } else
- { cursorx = 0;
-
- if (eol.source == eol.dest)
- FPutC(FileHandle, CR); // pass it through
- elif (eol.source == IBM && eol.dest == AMIGA)
- ; // do nothing
- elif (eol.source == IBM && eol.dest == MAC)
- FPutC(FileHandle, CR); // pass it through
- elif (eol.source == MAC && eol.dest == AMIGA)
- FPutC(FileHandle, LF); // convert from CR to LF
- elif (eol.source == MAC && eol.dest == IBM)
- { FPutC(FileHandle, CR); // pass this through
- FPutC(FileHandle, LF); // and add this
- } else ; // amiga as source: we never expect CRs
- } }
- elif (*(InputBufferPtr + i) == TAB)
- { if (eol.detabulate)
- { gap = (((cursorx / eol.tabsize) + 1) * eol.tabsize) - cursorx;
- for (j = 1; j <= gap; j++)
- FPutC(FileHandle, ' ');
- cursorx += gap;
- } else FPutC(FileHandle, TAB); // no point to cursorx in non-detabulate
- } else
- { FPutC(FileHandle, *(InputBufferPtr + i));
- cursorx++;
- } }
- /* Note that FPutC() returns EOF for errors; this is not currently
- checked. */
- ok = TRUE;
- Close(FileHandle);
- } }
- else
- { Close(FileHandle);
- } }
- FreeMem(InputBufferPtr, InputInfoBlock.fib_Size);
- } } }
- else
- { UnLock(FileHandle);
- } }
-
- if (gui)
- { if (ok)
- strcat(saystring, "done.");
- else strcat(saystring, "failed!");
-
- SetGadgetAttrs
- ( eol_gadgets[GID_7_ST2], MainWindowPtr, NULL,
- STRINGA_TextVal, saystring,
- TAG_END);
- } else
- { if (ok)
- Printf("done.\n");
- else Printf("failed!\n");
- }
-
- checkabort(gui);
- }
-
- AGLOBAL void eol_loop(ULONG gid)
- { STRPTR stringptr;
-
- switch(gid)
- {
- case GID_7_RA1:
- if (!(GetAttr
- ( RADIOBUTTON_Selected, eol_gadgets[GID_7_RA1], (ULONG *) &eol.source
- )))
- { rq("Unsupported inquiry!"); // should never happen
- }
- break;
- case GID_7_RA2:
- if (!(GetAttr
- ( RADIOBUTTON_Selected, eol_gadgets[GID_7_RA2], (ULONG *) &eol.dest
- )))
- { rq("Unsupported inquiry!"); // should never happen
- }
- break;
- case GID_7_ST1:
- if (!(GetAttr
- ( STRINGA_TextVal, eol_gadgets[GID_7_ST1], (ULONG *) &stringptr
- )))
- { rq("Unsupported inquiry!"); // should never happen
- }
- strcpy(eol.pathname, stringptr);
- break;
- case GID_7_BU1:
- strcpy(shared.pathname, eol.pathname);
- multiasl("#?.info");
- strcpy(eol.pathname, shared.pathname);
- SetGadgetAttrs
- ( eol_gadgets[GID_7_ST1], MainWindowPtr, NULL,
- STRINGA_TextVal, eol.pathname,
- TAG_END
- );
- break;
- case GID_7_BU3:
- eol_do();
- break;
- case GID_7_CB1:
- if (!(GetAttr
- ( GA_Selected, eol_gadgets[GID_7_CB1], (ULONG *) &eol.detabulate
- )))
- { rq("Unsupported inquiry!"); // should never happen
- }
- break;
- case GID_7_CB2:
- if (!(GetAttr
- ( GA_Selected, eol_gadgets[GID_7_CB2], (ULONG *) &eol.unwrap
- )))
- { rq("Unsupported inquiry!"); // should never happen
- }
- break;
- case GID_7_IN1:
- if (!(GetAttr
- ( INTEGER_Number, eol_gadgets[GID_7_IN1], (ULONG *) &eol.tabsize
- )))
- { rq("Unsupported inquiry!"); // should never happen
- }
- break;
- default:
- break;
- } }
-
- MODULE ABOOL spaceeol(TEXT nextchar)
- { if
- ( nextchar == ' '
- || nextchar == TAB
- || nextchar == LF
- || nextchar == CR
- )
- { return(FALSE);
- } else return(TRUE);
- }
-
- AGLOBAL void eol_die(void)
- { IOBuffer[1] = (UBYTE) eol.source;
- IOBuffer[2] = (UBYTE) eol.dest;
- IOBuffer[3] = (UBYTE) eol.detabulate;
- IOBuffer[4] = (UBYTE) eol.tabsize;
- IOBuffer[5] = (UBYTE) eol.unwrap;
- }
-
- AGLOBAL void eol_config(void)
- { eol.source = (ULONG) IOBuffer[1];
- eol.dest = (ULONG) IOBuffer[2];
- eol.detabulate = (ULONG) IOBuffer[3];
- eol.tabsize = (ULONG) IOBuffer[4];
- eol.unwrap = (ULONG) IOBuffer[5];
- }
-
- AGLOBAL ULONG Hook7Func(struct Hook *h, VOID *o, VOID *msg)
- { /* "When the hook is called, the data argument points to the
- window object and message argument to the IntuiMessage." */
-
- UWORD code, qual;
-
- geta4(); // wait till here before doing anything
-
- code = ((struct IntuiMessage *) msg)->Code;
- qual = ((struct IntuiMessage *) msg)->Qualifier;
-
- switch(code)
- {
- case SCAN_HELP:
- helpabout();
- break;
- case SCAN_ESCAPE:
- if ((qual & IEQUALIFIER_LSHIFT) || (qual & IEQUALIFIER_RSHIFT))
- { cleanexit(EXIT_SUCCESS);
- } else page = 0;
- break;
- case SCAN_D:
- if (!(qual & IEQUALIFIER_LSHIFT) && !(qual & IEQUALIFIER_RSHIFT))
- { if (eol.dest < 2)
- eol.dest++;
- else eol.dest = 0;
- } else
- { if (eol.dest > 0)
- eol.dest--;
- else eol.dest = 2;
- }
- SetGadgetAttrs
- ( eol_gadgets[GID_7_RA2], MainWindowPtr, NULL,
- RADIOBUTTON_Selected, eol.dest,
- TAG_END);
- // we must explicitly refresh
- RefreshGadgets((struct Gadget *) eol_gadgets[GID_7_RA2], MainWindowPtr, NULL);
- break;
- case SCAN_O:
- // the gadget is handled automatically by the system, all we need
- // to do is update our internal record of the state of the gadget
- if (!(GetAttr
- ( GA_Selected, eol_gadgets[GID_7_CB1], (ULONG *) &eol.detabulate
- )))
- { rq("Unsupported inquiry!"); // should never happen
- }
- break;
- case SCAN_P:
- ActivateLayoutGadget(eol_gadgets[GID_7_LY1], MainWindowPtr, NULL, (Object) eol_gadgets[GID_7_ST1]);
- break;
- case SCAN_S:
- if (!(qual & IEQUALIFIER_LSHIFT) && !(qual & IEQUALIFIER_RSHIFT))
- { if (eol.source < 2)
- eol.source++;
- else eol.source = 0;
- } else
- { if (eol.source > 0)
- eol.source--;
- else eol.source = 2;
- }
- SetGadgetAttrs
- ( eol_gadgets[GID_7_RA1], MainWindowPtr, NULL,
- RADIOBUTTON_Selected, eol.source,
- TAG_END);
-
- // we must explicitly refresh
- RefreshGadgets((struct Gadget *) eol_gadgets[GID_7_RA1], MainWindowPtr, NULL);
- break;
- case SCAN_T:
- ActivateLayoutGadget(eol_gadgets[GID_7_LY1], MainWindowPtr, NULL, (Object) eol_gadgets[GID_7_IN1]);
- break;
- case SCAN_U:
- // the gadget is handled automatically by the system, all we need
- // to do is update our internal record of the state of the gadget
- if (!(GetAttr
- ( GA_Selected, eol_gadgets[GID_7_CB2], (ULONG *) &eol.unwrap
- )))
- { rq("Unsupported inquiry!"); // should never happen
- }
- break;
- case SCAN_PERIOD:
- strcpy(shared.pathname, eol.pathname);
- multiasl("~(#?.info)");
- strcpy(eol.pathname, shared.pathname);
- SetGadgetAttrs
- ( eol_gadgets[GID_7_ST1], MainWindowPtr, NULL,
- STRINGA_TextVal, eol.pathname,
- TAG_END);
- break;
- default:
- break;
- }
-
- return(1);
- }
-
-
-